// dxtTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <conio.h>
#include "dxt++.h"
#include "memory.h"
#include <cassert>
#include "huffman.h"

int _tmain(int argc, _TCHAR* argv[])
{
	dds2dpp( "Lenna.dpp", "Lenna.dds", 10 );
	dpp2dds( "Lenna-c.dds", "Lenna.dpp" );

	//FILE* fp = fopen( "SlimXml.cpp", "rb" );
	//if ( fp == NULL )
	//{
	//	return 0;
	//}
	//fseek( fp, 0, SEEK_END );
	//size_t fileSize = ftell( fp );
	//fseek( fp, 0, SEEK_SET );

	//unsigned char* buffer = new unsigned char[fileSize];
	//fread( buffer, fileSize, 1, fp );
	//fclose( fp );
	//unsigned char* compressed = new unsigned char[fileSize];

	//HuffmanTree<unsigned char> tree;
	//size_t compressedSize = tree.compress( buffer, fileSize, compressed, fileSize );

	//delete[] buffer;
	//delete[] compressed;
	
	return 0;

	//FILE* fp = fopen( "diffuse.dds", "rb" );
	//if ( fp == NULL )
	//{
	//	return 0;
	//}
	//fseek( fp, 0, SEEK_END );
	//size_t fileSize = ftell( fp );
	//fseek( fp, 0, SEEK_SET );

	//unsigned char* buffer = new unsigned char[fileSize];
	//fread( buffer, fileSize, 1, fp );
	//fclose( fp );

	//unsigned char* compressed = new unsigned char[fileSize * 2];
	//size_t compressedSize = dppCompress( buffer, fileSize, compressed, fileSize * 2 );
	//if ( compressedSize == 0 )
	//{
	//	delete[] buffer;
	//	delete[] compressed;
	//	return 0;
	//}

	//size_t extractedSize = dppGetExtractedSize( compressed );
	//assert( extractedSize == fileSize );
	//unsigned char* extracted = new unsigned char[extractedSize];
	//size_t finalSize = dppExtract( compressed, compressedSize, extracted, extractedSize );
	//assert( finalSize == extractedSize );

	//int compareResult = memcmp( extracted, buffer, finalSize );
	//assert( compareResult == 0 );

	//delete[] buffer;
	//delete[] compressed;
	//delete[] extracted;

	//wprintf( L"Press any key." );
	//_getch();
	//return 0;
}

